/**
 * Created by Administrator on 2019/11/6.
 */
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
module.exports = {
	mode: 'development',
	devServer: {
		port: 3000,
		contentBase: './src',
		compress: true
	},
	entry: './src/main.js',
	output: {
		filename: 'bundle.js',
		path: path.resolve(__dirname, 'dist')
	},
	module: {
		rules: [
			{
				test: /\.css$/, use: [{
					loader: 'style-loader'
				},
					'css-loader'
				]
			}, 
			{
				test: /\.less$/, use: [{
					loader: 'style-loader'
				},
					'css-loader',
					'less-loader'
				]
			}, 
			{
				test:/\.scss$/,use:[{
					loader:'style-loader'
				},
				    'css-loader',
				    'sass-loader'
			    ]
			},
			{
				test: /\.(jpg|png|gif)$/, use: 'url-loader'
			},
			{
				test:/\.vue$/,use:'vue-loader'
			},
			{
                test: /\.js$/,
                exclude: /(node_modules)/,
                loader: 'babel-loader'
            },
			{
				test:/.(png|gif|jpg|svg|ttf)$/,
				use:[
					'file-loader'
				]
			}
		]
	},
	plugins: [
		new HtmlWebpackPlugin({
			template: './src/index.html',
			filename: 'index.html'
		}),
		new VueLoaderPlugin()
	]
};